package com.bolun998300.personal_blog_springboot.pojo;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

@Entity
@Table(name="tag")
@JsonIgnoreProperties({ "handler","hibernateLazyInitializer" })
public class Tag implements Comparable<Tag> {
	
	@Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)//主键生成策略，主键自增长
    @Column(name = "id")
	private int id;
	
	@Column(name="tag_name")
	private String tagName;
	
	@Column(name="tag_createdate")
	private Date tagCreateDate;
	
	@Transient
	private long blogCount;
	
	
	
	public long getBlogNum() {
		return blogCount;
	}

	public void setBlogNum(long blogCount) {
		this.blogCount = blogCount;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getTagName() {
		return tagName;
	}

	public void setTagName(String tagName) {
		this.tagName = tagName;
	}

	public Date getTagCreateDate() {
		return tagCreateDate;
	}

	public void setTagCreateDate(Date tagCreateDate) {
		this.tagCreateDate = tagCreateDate;
	}


	@Override
	public int compareTo(Tag tag) {
		return (int)(tag.getBlogNum()-this.blogCount);
	}
}
